#include "app_buffer.h"
#include "log/log.h"

int main()
{
    Buffer *buffer = app_buffer_init(20);

    // 写数据
    app_buffer_write(buffer, "abcdef", 6);
    app_buffer_write(buffer, "123456", 6);

    // 读数据1
    char data_buf1[6];
    int data_len1 = app_buffer_read(buffer, data_buf1, 6);
    log_debug("data_buf1: %.*s, data_len1: %d", data_len1, data_buf1, data_len1);
    // 读数据2
    char data_buf2[6];
    int data_len2 = app_buffer_read(buffer, data_buf2, 6);
    log_debug("data_buf2: %.*s, data_len2: %d", data_len2, data_buf2, data_len2);

    // 读数据3
    // char data_buf3[6];
    // int data_len3 = app_buffer_read(buffer, data_buf3, 6);
    // log_debug("data_buf3: %.*s, data_len3: %d", data_len3, data_buf3, data_len3);
}